package com.azunitech.guice;

import org.apache.log4j.Logger;

public class EmployeeRepository implements IRepository{
	private static Logger logger = Logger.getLogger(EmployeeRepository.class);
	private SimpleEHCache simpleEHCacheExample;
	public EmployeeRepository(){
        simpleEHCacheExample = new SimpleEHCache();
	}
	
	@Cached(cacheName = "getEmployee")
	public Employee getEmployee(Integer emplId) {
		logger.info("Query employee with " + emplId);
		return simpleEHCacheExample.getEmployee(emplId);
	}

	public void persistEmployee(Employee employee) {
		logger.info(employee);
		simpleEHCacheExample.addEmployee(employee.getEmplId(), employee);
	}
}
